package com.kfm.base.member;

public abstract class Student {

    public abstract void play();


    public void study() {
        System.out.println("学习");
    }
}

class StudentTest {

    public static void main(String[] args) {
        // 局部类, 当 main 方法调用结束，就销毁
        class Stu extends Student {

            @Override
            public void play() {
                System.out.println("玩游戏");
            }

            public void test(){
                System.out.println("test");
            }
        }

        Stu s = new Stu();

        s.study();

        // 匿名类
        Student stu = new Student() {
            @Override
            public void play() {
                System.out.println("玩游戏");
            }
            public void test(){
                System.out.println("test");
            }
        };



        Person p = new Person();

        p.say();


        Person p1 = new Person(){
            @Override
            public void say(){
                System.out.println("放");
            }
        };

        p1.say();


    }


}


